unit FormClient;

interface

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, FrameMainEdit, FrameClient, FrameAddWorker;

type
    TfrmClient = class(TForm)
        procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
        procedure FormShow(Sender: TObject);
    public
        Frame: TfrmeMainEdit;
        { Public declarations }
        constructor Create(AOwner: TComponent; aClientId: Integer; IsWorker: boolean = false); reintroduce;
        function GetCloseMode: byte;
    end;

implementation

{$R *.dfm}

{ TfrmClient }

constructor TfrmClient.Create(AOwner: TComponent; aClientId: Integer; IsWorker: boolean);
begin
    inherited Create(AOwner);
    if not IsWorker then begin
        ClientHeight := 310;
        ClientWidth := 570;
        Frame := TfrmeClient.Create(AOwner, aClientId);
        Frame.Parent := self;
    end
    else begin
        ClientHeight := 275;
        Frame := TfrmeAddWorker.Create(AOwner, aClientId);
        Frame.Parent := self;
    end;
end;

procedure TfrmClient.FormCloseQuery(Sender: TObject;
    var CanClose: Boolean);
begin
    CanClose := Frame.CloseQuery;
end;

function TfrmClient.GetCloseMode: byte;
begin
    Result := Frame.GetCloseMode;
end;

procedure TfrmClient.FormShow(Sender: TObject);
begin
    if Frame is TfrmeClient then
        TfrmeClient(Frame).cxeLastname.SetFocus;
    if Frame is TfrmeAddWorker then
        TfrmeAddWorker(Frame).cxeLastname.SetFocus;
end;

end.

